Skip to content

[EuiAccordion] Migrate from class to function component#9558

Open
antonbc wants to merge 5 commits intoelastic:mainfrom
antonbc:refactor/accordion-function-component
Open

[EuiAccordion] Migrate from class to function component#9558
antonbc wants to merge 5 commits intoelastic:mainfrom
antonbc:refactor/accordion-function-component

Conversation

@antonbc
Copy link
Copy Markdown

@antonbc antonbc commented Apr 4, 2026

Summary

API Changes

No API changes.

component / parent prop / child change description

Screenshots

No visual changes

Before After
{Before image} {After image}

Impact Assessment

Note: Most PRs should be tested in Kibana to help gauge their Impact before merging.

  • 🔴 Breaking changes
  • 💅 Visual changes
  • 🧪 Test impact — None. All 39 existing tests pass, 21 snapshots match.
  • 🔧 Hard to integrate

Impact level: 🟢 None / 🟢 Low / 🟡 Moderate / 🔴 High

Release Readiness

  • Documentation:
  • Figma:
  • Migration guide:
  • Adoption plan

QA instructions for reviewer

Checklist before marking Ready for Review

Reviewer checklist

  • Convert to function component with useState
  • Replace withEuiTheme HOC with useEuiTheme hook if applicable
  • Maintain controlled/uncontrolled open state behavior
  • All existing tests pass

@antonbc antonbc requested a review from a team as a code owner April 4, 2026 07:30
Copilot AI review requested due to automatic review settings April 4, 2026 07:30
@cla-checker-service
Copy link
Copy Markdown

cla-checker-service Bot commented Apr 4, 2026

💚 CLA has been signed

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 4, 2026

👋 Since this is a community submitted pull request, a Buildkite build has not been started automatically. Would an Elastic organization member please verify the contents of this pull request and kick off a build manually?

@github-actions github-actions Bot added the community contribution (Don't delete - used for automation) label Apr 4, 2026
@antonbc antonbc closed this Apr 4, 2026
@antonbc antonbc reopened this Apr 4, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 4, 2026

👋 Since this is a community submitted pull request, a Buildkite build has not been started automatically. Would an Elastic organization member please verify the contents of this pull request and kick off a build manually?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates EuiAccordion from a class component wrapped in withEuiTheme to a function component that uses hooks (useEuiTheme, useGeneratedHtmlId) while aiming to keep behavior and public API the same.

Changes:

  • Replaced class state/handlers with useState and an internal toggle handler.
  • Replaced withEuiTheme + WithEuiThemeProps usage with useEuiTheme.
  • Replaced htmlIdGenerator() instance property with useGeneratedHtmlId().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/eui/src/components/accordion/accordion.tsx Outdated
Comment thread packages/eui/src/components/accordion/accordion.tsx Outdated
antonbc added a commit to antonbc/eui that referenced this pull request Apr 4, 2026
@weronikaolejniczak weronikaolejniczak added the skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation) label Apr 7, 2026
Comment thread packages/eui/changelogs/upcoming/9558.md Outdated
Comment thread packages/eui/src/components/accordion/accordion.tsx Outdated
antonbc added a commit to antonbc/eui that referenced this pull request Apr 7, 2026
Comment thread packages/eui/src/components/accordion/accordion.tsx Outdated
@antonbc antonbc force-pushed the refactor/accordion-function-component branch from 087711b to bbad3a9 Compare May 5, 2026 06:42
@antonbc
Copy link
Copy Markdown
Author

antonbc commented May 5, 2026

Hi, I have removed the unnecessary changelog and addressed all the comments. Please let me know if anything else needs attention!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Contributor

@weronikaolejniczak weronikaolejniczak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything LGTM! Thank you for addressing my comments and for contributing, @antonbc 🙏🏻

The next EUI release scope is closed so we won't be able to merge the PR this week.

@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community contribution (Don't delete - used for automation) skip-changelog Use on PRs to skip changelog requirement (Don't delete - used for automation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants